class DEAapp
  @dea_app_info = {}
  class <<self
    def process_app_advertise_message(msg)
      CloudController.logger.debug("Got DEA app advertisement#{msg}.")
      dea_uuid = msg[:id]
      if msg[:id] == dea_uuid
        @dea_app_info[dea_uuid] = msg
      else
        @dea_app_info
      end
    end

    def dea_app_summary
      return [] if @dea_app_info.nil?
      @dea_app_info.each do |key,instance|
        time = Time.now.to_i
        if time - instance[:time] > 10
          uuid = key
          @dea_app_info.delete(uuid)
        else
          @dea_app_info
        end
        @dea_app_info
      end
    end
  end
end